<!doctype html>
<html class="default no-js">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>OrderedBulkOperation | mongodb</title>
	<meta name="description" content="Documentation for mongodb">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="../assets/css/main.css">
	<script async src="../assets/js/search.js" id="search-script"></script>
</head>
<body>
<header>
	<div class="tsd-page-toolbar">
		<div class="container">
			<div class="table-wrap">
				<div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base="..">
					<div class="field">
						<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
						<input id="tsd-search-field" type="text" />
					</div>
					<ul class="results">
						<li class="state loading">Preparing search index...</li>
						<li class="state failure">The search index is not available</li>
					</ul>
					<a href="../index.html" class="title">mongodb</a>
				</div>
				<div class="table-cell" id="tsd-widgets">
					<div id="tsd-filter">
						<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
						<div class="tsd-filter-group">
							<div class="tsd-select" id="tsd-filter-visibility">
								<span class="tsd-select-label">All</span>
								<ul class="tsd-select-list">
									<li data-value="public">Public</li>
									<li data-value="protected">Public/Protected</li>
									<li data-value="private" class="selected">All</li>
								</ul>
							</div>
							<input type="checkbox" id="tsd-filter-inherited" checked />
							<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
							<input type="checkbox" id="tsd-filter-externals" checked />
							<label class="tsd-widget" for="tsd-filter-externals">Externals</label>
						</div>
					</div>
					<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
				</div>
			</div>
		</div>
	</div>
	<div class="tsd-page-title">
		<div class="container">
			<ul class="tsd-breadcrumb">
				<li>
					<a href="../modules.html">mongodb</a>
				</li>
				<li>
					<a href="orderedbulkoperation.html">OrderedBulkOperation</a>
				</li>
			</ul>
			<h1>Class OrderedBulkOperation</h1>
		</div>
	</div>
</header>
<div class="container container-main">
	<div class="row">
		<div class="col-8 col-content">
			<section class="tsd-panel tsd-hierarchy">
				<h3>Hierarchy</h3>
				<ul class="tsd-hierarchy">
					<li>
						<a href="bulkoperationbase.html" class="tsd-signature-type" data-tsd-kind="Class">BulkOperationBase</a>
						<ul class="tsd-hierarchy">
							<li>
								<span class="target">OrderedBulkOperation</span>
							</li>
						</ul>
					</li>
				</ul>
			</section>
			<section class="tsd-panel-group tsd-index-group">
				<h2>Index</h2>
				<section class="tsd-panel tsd-index-panel">
					<div class="tsd-index-content">
						<section class="tsd-index-section ">
							<h3>Constructors</h3>
							<ul class="tsd-index-list">
								<li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite"><a href="orderedbulkoperation.html#constructor" class="tsd-kind-icon">constructor</a></li>
							</ul>
						</section>
						<section class="tsd-index-section tsd-is-inherited">
							<h3>Properties</h3>
							<ul class="tsd-index-list">
								<li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><a href="orderedbulkoperation.html#isordered" class="tsd-kind-icon">is<wbr>Ordered</a></li>
								<li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><a href="orderedbulkoperation.html#operationid" class="tsd-kind-icon">operation<wbr>Id</a></li>
								<li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><a href="orderedbulkoperation.html#s" class="tsd-kind-icon">s</a></li>
							</ul>
						</section>
						<section class="tsd-index-section ">
							<h3>Accessors</h3>
							<ul class="tsd-index-list">
								<li class="tsd-kind-get-signature tsd-parent-kind-class tsd-is-inherited"><a href="orderedbulkoperation.html#batches" class="tsd-kind-icon">batches</a></li>
								<li class="tsd-kind-get-signature tsd-parent-kind-class tsd-is-inherited"><a href="orderedbulkoperation.html#bsonoptions" class="tsd-kind-icon">bson<wbr>Options</a></li>
								<li class="tsd-kind-get-signature tsd-parent-kind-class tsd-is-inherited"><a href="orderedbulkoperation.html#writeconcern" class="tsd-kind-icon">write<wbr>Concern</a></li>
							</ul>
						</section>
						<section class="tsd-index-section ">
							<h3>Methods</h3>
							<ul class="tsd-index-list">
								<li class="tsd-kind-method tsd-parent-kind-class tsd-is-overwrite"><a href="orderedbulkoperation.html#addtooperationslist" class="tsd-kind-icon">add<wbr>ToOperations<wbr>List</a></li>
								<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="orderedbulkoperation.html#execute" class="tsd-kind-icon">execute</a></li>
								<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="orderedbulkoperation.html#find" class="tsd-kind-icon">find</a></li>
								<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="orderedbulkoperation.html#handlewriteerror" class="tsd-kind-icon">handle<wbr>Write<wbr>Error</a></li>
								<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="orderedbulkoperation.html#insert" class="tsd-kind-icon">insert</a></li>
								<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="orderedbulkoperation.html#raw" class="tsd-kind-icon">raw</a></li>
							</ul>
						</section>
					</div>
				</section>
			</section>
			<section class="tsd-panel-group tsd-member-group ">
				<h2>Constructors</h2>
				<section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite">
					<a name="constructor" class="tsd-anchor"></a>
					<h3>constructor</h3>
					<ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite">
						<li class="tsd-signature tsd-kind-icon">new <wbr>Ordered<wbr>Bulk<wbr>Operation<span class="tsd-signature-symbol">(</span>collection<span class="tsd-signature-symbol">: </span><a href="collection.html" class="tsd-signature-type" data-tsd-kind="Class">Collection</a><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/document.html" class="tsd-signature-type" data-tsd-kind="Interface">Document</a><span class="tsd-signature-symbol">&gt;</span>, options<span class="tsd-signature-symbol">: </span><a href="../interfaces/bulkwriteoptions.html" class="tsd-signature-type" data-tsd-kind="Interface">BulkWriteOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="orderedbulkoperation.html" class="tsd-signature-type" data-tsd-kind="Class">OrderedBulkOperation</a></li>
					</ul>
					<ul class="tsd-descriptions">
						<li class="tsd-description">
							<aside class="tsd-sources">
								<p>Overrides <a href="bulkoperationbase.html">BulkOperationBase</a>.<a href="bulkoperationbase.html#constructor">constructor</a></p>
								<ul>
									<li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/b67af3cd/src/bulk/ordered.ts#L10">src/bulk/ordered.ts:10</a></li>
								</ul>
							</aside>
							<div class="tsd-comment tsd-typography">
								<div class="lead">
									<p>Create a new OrderedBulkOperation or UnorderedBulkOperation instance</p>
								</div>
							</div>
							<h4 class="tsd-parameters-title">Parameters</h4>
							<ul class="tsd-parameters">
								<li>
									<h5>collection: <a href="collection.html" class="tsd-signature-type" data-tsd-kind="Class">Collection</a><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/document.html" class="tsd-signature-type" data-tsd-kind="Interface">Document</a><span class="tsd-signature-symbol">&gt;</span></h5>
								</li>
								<li>
									<h5>options: <a href="../interfaces/bulkwriteoptions.html" class="tsd-signature-type" data-tsd-kind="Interface">BulkWriteOptions</a></h5>
								</li>
							</ul>
							<h4 class="tsd-returns-title">Returns <a href="orderedbulkoperation.html" class="tsd-signature-type" data-tsd-kind="Class">OrderedBulkOperation</a></h4>
						</li>
					</ul>
				</section>
			</section>
			<section class="tsd-panel-group tsd-member-group tsd-is-inherited">
				<h2>Properties</h2>
				<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited">
					<a name="isordered" class="tsd-anchor"></a>
					<h3>is<wbr>Ordered</h3>
					<div class="tsd-signature tsd-kind-icon">is<wbr>Ordered<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div>
					<aside class="tsd-sources">
						<p>Inherited from <a href="bulkoperationbase.html">BulkOperationBase</a>.<a href="bulkoperationbase.html#isordered">isOrdered</a></p>
						<ul>
							<li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/b67af3cd/src/bulk/common.ts#L883">src/bulk/common.ts:883</a></li>
						</ul>
					</aside>
				</section>
				<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited">
					<a name="operationid" class="tsd-anchor"></a>
					<h3><span class="tsd-flag ts-flagOptional">Optional</span> operation<wbr>Id</h3>
					<div class="tsd-signature tsd-kind-icon">operation<wbr>Id<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
					<aside class="tsd-sources">
						<p>Inherited from <a href="bulkoperationbase.html">BulkOperationBase</a>.<a href="bulkoperationbase.html#operationid">operationId</a></p>
						<ul>
							<li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/b67af3cd/src/bulk/common.ts#L886">src/bulk/common.ts:886</a></li>
						</ul>
					</aside>
				</section>
				<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited">
					<a name="s" class="tsd-anchor"></a>
					<h3>s</h3>
					<div class="tsd-signature tsd-kind-icon">s<span class="tsd-signature-symbol">:</span> <a href="../interfaces/bulkoperationprivate.html" class="tsd-signature-type" data-tsd-kind="Interface">BulkOperationPrivate</a></div>
					<aside class="tsd-sources">
						<p>Inherited from <a href="bulkoperationbase.html">BulkOperationBase</a>.<a href="bulkoperationbase.html#s">s</a></p>
						<ul>
							<li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/b67af3cd/src/bulk/common.ts#L885">src/bulk/common.ts:885</a></li>
						</ul>
					</aside>
					<div class="tsd-comment tsd-typography">
						<dl class="tsd-comment-tags">
							<dt>internal</dt>
							<dd></dd>
						</dl>
					</div>
				</section>
			</section>
			<section class="tsd-panel-group tsd-member-group ">
				<h2>Accessors</h2>
				<section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class tsd-is-inherited">
					<a name="batches" class="tsd-anchor"></a>
					<h3>batches</h3>
					<ul class="tsd-signatures tsd-kind-get-signature tsd-parent-kind-class tsd-is-inherited">
						<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">get</span> batches<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="batch.html" class="tsd-signature-type" data-tsd-kind="Class">Batch</a><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/document.html" class="tsd-signature-type" data-tsd-kind="Interface">Document</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">[]</span></li>
					</ul>
					<ul class="tsd-descriptions">
						<li class="tsd-description">
							<aside class="tsd-sources">
								<ul>
									<li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/b67af3cd/src/bulk/common.ts#L1162">src/bulk/common.ts:1162</a></li>
								</ul>
							</aside>
							<h4 class="tsd-returns-title">Returns <a href="batch.html" class="tsd-signature-type" data-tsd-kind="Class">Batch</a><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/document.html" class="tsd-signature-type" data-tsd-kind="Interface">Document</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">[]</span></h4>
						</li>
					</ul>
				</section>
				<section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class tsd-is-inherited">
					<a name="bsonoptions" class="tsd-anchor"></a>
					<h3>bson<wbr>Options</h3>
					<ul class="tsd-signatures tsd-kind-get-signature tsd-parent-kind-class tsd-is-inherited">
						<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">get</span> bsonOptions<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../interfaces/bsonserializeoptions.html" class="tsd-signature-type" data-tsd-kind="Interface">BSONSerializeOptions</a></li>
					</ul>
					<ul class="tsd-descriptions">
						<li class="tsd-description">
							<aside class="tsd-sources">
								<ul>
									<li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/b67af3cd/src/bulk/common.ts#L1154">src/bulk/common.ts:1154</a></li>
								</ul>
							</aside>
							<h4 class="tsd-returns-title">Returns <a href="../interfaces/bsonserializeoptions.html" class="tsd-signature-type" data-tsd-kind="Interface">BSONSerializeOptions</a></h4>
						</li>
					</ul>
				</section>
				<section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class tsd-is-inherited">
					<a name="writeconcern" class="tsd-anchor"></a>
					<h3>write<wbr>Concern</h3>
					<ul class="tsd-signatures tsd-kind-get-signature tsd-parent-kind-class tsd-is-inherited">
						<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">get</span> writeConcern<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="writeconcern.html" class="tsd-signature-type" data-tsd-kind="Class">WriteConcern</a></li>
					</ul>
					<ul class="tsd-descriptions">
						<li class="tsd-description">
							<aside class="tsd-sources">
								<ul>
									<li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/b67af3cd/src/bulk/common.ts#L1158">src/bulk/common.ts:1158</a></li>
								</ul>
							</aside>
							<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="writeconcern.html" class="tsd-signature-type" data-tsd-kind="Class">WriteConcern</a></h4>
						</li>
					</ul>
				</section>
			</section>
			<section class="tsd-panel-group tsd-member-group ">
				<h2>Methods</h2>
				<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-overwrite">
					<a name="addtooperationslist" class="tsd-anchor"></a>
					<h3>add<wbr>ToOperations<wbr>List</h3>
					<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-overwrite">
						<li class="tsd-signature tsd-kind-icon">add<wbr>ToOperations<wbr>List<span class="tsd-signature-symbol">(</span>batchType<span class="tsd-signature-symbol">: </span><a href="../modules.html#batchtype" class="tsd-signature-type" data-tsd-kind="Variable">BatchType</a>, document<span class="tsd-signature-symbol">: </span><a href="../interfaces/document.html" class="tsd-signature-type" data-tsd-kind="Interface">Document</a><span class="tsd-signature-symbol"> | </span><a href="../interfaces/updatestatement.html" class="tsd-signature-type" data-tsd-kind="Interface">UpdateStatement</a><span class="tsd-signature-symbol"> | </span><a href="../interfaces/deletestatement.html" class="tsd-signature-type" data-tsd-kind="Interface">DeleteStatement</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="orderedbulkoperation.html" class="tsd-signature-type" data-tsd-kind="Class">OrderedBulkOperation</a></li>
					</ul>
					<ul class="tsd-descriptions">
						<li class="tsd-description">
							<aside class="tsd-sources">
								<p>Overrides <a href="bulkoperationbase.html">BulkOperationBase</a>.<a href="bulkoperationbase.html#addtooperationslist">addToOperationsList</a></p>
								<ul>
									<li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/b67af3cd/src/bulk/ordered.ts#L15">src/bulk/ordered.ts:15</a></li>
								</ul>
							</aside>
							<h4 class="tsd-parameters-title">Parameters</h4>
							<ul class="tsd-parameters">
								<li>
									<h5>batchType: <a href="../modules.html#batchtype" class="tsd-signature-type" data-tsd-kind="Variable">BatchType</a></h5>
								</li>
								<li>
									<h5>document: <a href="../interfaces/document.html" class="tsd-signature-type" data-tsd-kind="Interface">Document</a><span class="tsd-signature-symbol"> | </span><a href="../interfaces/updatestatement.html" class="tsd-signature-type" data-tsd-kind="Interface">UpdateStatement</a><span class="tsd-signature-symbol"> | </span><a href="../interfaces/deletestatement.html" class="tsd-signature-type" data-tsd-kind="Interface">DeleteStatement</a></h5>
								</li>
							</ul>
							<h4 class="tsd-returns-title">Returns <a href="orderedbulkoperation.html" class="tsd-signature-type" data-tsd-kind="Class">OrderedBulkOperation</a></h4>
						</li>
					</ul>
				</section>
				<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
					<a name="execute" class="tsd-anchor"></a>
					<h3>execute</h3>
					<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
						<li class="tsd-signature tsd-kind-icon">execute<span class="tsd-signature-symbol">(</span>options<span class="tsd-signature-symbol">?: </span><a href="../interfaces/bulkwriteoptions.html" class="tsd-signature-type" data-tsd-kind="Interface">BulkWriteOptions</a>, callback<span class="tsd-signature-symbol">?: </span><a href="../modules.html#callback" class="tsd-signature-type" data-tsd-kind="Type alias">Callback</a><span class="tsd-signature-symbol">&lt;</span><a href="bulkwriteresult.html" class="tsd-signature-type" data-tsd-kind="Class">BulkWriteResult</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="bulkwriteresult.html" class="tsd-signature-type" data-tsd-kind="Class">BulkWriteResult</a><span class="tsd-signature-symbol">&gt;</span></li>
					</ul>
					<ul class="tsd-descriptions">
						<li class="tsd-description">
							<aside class="tsd-sources">
								<p>Inherited from <a href="bulkoperationbase.html">BulkOperationBase</a>.<a href="bulkoperationbase.html#execute">execute</a></p>
								<ul>
									<li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/b67af3cd/src/bulk/common.ts#L1175">src/bulk/common.ts:1175</a></li>
								</ul>
							</aside>
							<div class="tsd-comment tsd-typography">
								<div class="lead">
									<p>An internal helper method. Do not invoke directly. Will be going away in the future</p>
								</div>
							</div>
							<h4 class="tsd-parameters-title">Parameters</h4>
							<ul class="tsd-parameters">
								<li>
									<h5><span class="tsd-flag ts-flagOptional">Optional</span> options: <a href="../interfaces/bulkwriteoptions.html" class="tsd-signature-type" data-tsd-kind="Interface">BulkWriteOptions</a></h5>
								</li>
								<li>
									<h5><span class="tsd-flag ts-flagOptional">Optional</span> callback: <a href="../modules.html#callback" class="tsd-signature-type" data-tsd-kind="Type alias">Callback</a><span class="tsd-signature-symbol">&lt;</span><a href="bulkwriteresult.html" class="tsd-signature-type" data-tsd-kind="Class">BulkWriteResult</a><span class="tsd-signature-symbol">&gt;</span></h5>
								</li>
							</ul>
							<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="bulkwriteresult.html" class="tsd-signature-type" data-tsd-kind="Class">BulkWriteResult</a><span class="tsd-signature-symbol">&gt;</span></h4>
						</li>
					</ul>
				</section>
				<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
					<a name="find" class="tsd-anchor"></a>
					<h3>find</h3>
					<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
						<li class="tsd-signature tsd-kind-icon">find<span class="tsd-signature-symbol">(</span>selector<span class="tsd-signature-symbol">: </span><a href="../interfaces/document.html" class="tsd-signature-type" data-tsd-kind="Interface">Document</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="findoperators.html" class="tsd-signature-type" data-tsd-kind="Class">FindOperators</a></li>
					</ul>
					<ul class="tsd-descriptions">
						<li class="tsd-description">
							<aside class="tsd-sources">
								<p>Inherited from <a href="bulkoperationbase.html">BulkOperationBase</a>.<a href="bulkoperationbase.html#find">find</a></p>
								<ul>
									<li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/b67af3cd/src/bulk/common.ts#L1050">src/bulk/common.ts:1050</a></li>
								</ul>
							</aside>
							<div class="tsd-comment tsd-typography">
								<div class="lead">
									<p>Builds a find operation for an update/updateOne/delete/deleteOne/replaceOne.
									Returns a builder object used to complete the definition of the operation.</p>
								</div>
								<dl class="tsd-comment-tags">
									<dt>example</dt>
									<dd><pre><code class="language-js"><span style="color: #0000FF">const</span><span style="color: #000000"> </span><span style="color: #0070C1">bulkOp</span><span style="color: #000000"> = </span><span style="color: #001080">collection</span><span style="color: #000000">.</span><span style="color: #795E26">initializeOrderedBulkOp</span><span style="color: #000000">();</span>

<span style="color: #008000">// Add an updateOne to the bulkOp</span>
<span style="color: #001080">bulkOp</span><span style="color: #000000">.</span><span style="color: #795E26">find</span><span style="color: #000000">({ </span><span style="color: #001080">a:</span><span style="color: #000000"> </span><span style="color: #098658">1</span><span style="color: #000000"> }).</span><span style="color: #795E26">updateOne</span><span style="color: #000000">({ </span><span style="color: #001080">$set:</span><span style="color: #000000"> { </span><span style="color: #001080">b:</span><span style="color: #000000"> </span><span style="color: #098658">2</span><span style="color: #000000"> } });</span>

<span style="color: #008000">// Add an updateMany to the bulkOp</span>
<span style="color: #001080">bulkOp</span><span style="color: #000000">.</span><span style="color: #795E26">find</span><span style="color: #000000">({ </span><span style="color: #001080">c:</span><span style="color: #000000"> </span><span style="color: #098658">3</span><span style="color: #000000"> }).</span><span style="color: #795E26">update</span><span style="color: #000000">({ </span><span style="color: #001080">$set:</span><span style="color: #000000"> { </span><span style="color: #001080">d:</span><span style="color: #000000"> </span><span style="color: #098658">4</span><span style="color: #000000"> } });</span>

<span style="color: #008000">// Add an upsert</span>
<span style="color: #001080">bulkOp</span><span style="color: #000000">.</span><span style="color: #795E26">find</span><span style="color: #000000">({ </span><span style="color: #001080">e:</span><span style="color: #000000"> </span><span style="color: #098658">5</span><span style="color: #000000"> }).</span><span style="color: #795E26">upsert</span><span style="color: #000000">().</span><span style="color: #795E26">updateOne</span><span style="color: #000000">({ </span><span style="color: #001080">$set:</span><span style="color: #000000"> { </span><span style="color: #001080">f:</span><span style="color: #000000"> </span><span style="color: #098658">6</span><span style="color: #000000"> } });</span>

<span style="color: #008000">// Add a deletion</span>
<span style="color: #001080">bulkOp</span><span style="color: #000000">.</span><span style="color: #795E26">find</span><span style="color: #000000">({ </span><span style="color: #001080">g:</span><span style="color: #000000"> </span><span style="color: #098658">7</span><span style="color: #000000"> }).</span><span style="color: #795E26">deleteOne</span><span style="color: #000000">();</span>

<span style="color: #008000">// Add a multi deletion</span>
<span style="color: #001080">bulkOp</span><span style="color: #000000">.</span><span style="color: #795E26">find</span><span style="color: #000000">({ </span><span style="color: #001080">h:</span><span style="color: #000000"> </span><span style="color: #098658">8</span><span style="color: #000000"> }).</span><span style="color: #795E26">delete</span><span style="color: #000000">();</span>

<span style="color: #008000">// Add a replaceOne</span>
<span style="color: #001080">bulkOp</span><span style="color: #000000">.</span><span style="color: #795E26">find</span><span style="color: #000000">({ </span><span style="color: #001080">i:</span><span style="color: #000000"> </span><span style="color: #098658">9</span><span style="color: #000000"> }).</span><span style="color: #795E26">replaceOne</span><span style="color: #000000">({</span><span style="color: #001080">writeConcern:</span><span style="color: #000000"> { </span><span style="color: #001080">j:</span><span style="color: #000000"> </span><span style="color: #098658">10</span><span style="color: #000000"> }});</span>

<span style="color: #008000">// Update using a pipeline (requires Mongodb 4.2 or higher)</span>
<span style="color: #001080">bulk</span><span style="color: #000000">.</span><span style="color: #795E26">find</span><span style="color: #000000">({ </span><span style="color: #001080">k:</span><span style="color: #000000"> </span><span style="color: #098658">11</span><span style="color: #000000">, </span><span style="color: #001080">y:</span><span style="color: #000000"> { </span><span style="color: #001080">$exists:</span><span style="color: #000000"> </span><span style="color: #0000FF">true</span><span style="color: #000000"> }, </span><span style="color: #001080">z:</span><span style="color: #000000"> { </span><span style="color: #001080">$exists:</span><span style="color: #000000"> </span><span style="color: #0000FF">true</span><span style="color: #000000"> } }).</span><span style="color: #795E26">updateOne</span><span style="color: #000000">([</span>
<span style="color: #000000">  { </span><span style="color: #001080">$set:</span><span style="color: #000000"> { </span><span style="color: #001080">total:</span><span style="color: #000000"> { </span><span style="color: #001080">$sum:</span><span style="color: #000000"> [ </span><span style="color: #A31515">&#039;$y&#039;</span><span style="color: #000000">, </span><span style="color: #A31515">&#039;$z&#039;</span><span style="color: #000000"> ] } } }</span>
<span style="color: #000000">]);</span>

<span style="color: #008000">// All of the ops will now be executed</span>
<span style="color: #AF00DB">await</span><span style="color: #000000"> </span><span style="color: #001080">bulkOp</span><span style="color: #000000">.</span><span style="color: #795E26">execute</span><span style="color: #000000">();</span>
</code></pre>
									</dd>
								</dl>
							</div>
							<h4 class="tsd-parameters-title">Parameters</h4>
							<ul class="tsd-parameters">
								<li>
									<h5>selector: <a href="../interfaces/document.html" class="tsd-signature-type" data-tsd-kind="Interface">Document</a></h5>
								</li>
							</ul>
							<h4 class="tsd-returns-title">Returns <a href="findoperators.html" class="tsd-signature-type" data-tsd-kind="Class">FindOperators</a></h4>
						</li>
					</ul>
				</section>
				<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
					<a name="handlewriteerror" class="tsd-anchor"></a>
					<h3>handle<wbr>Write<wbr>Error</h3>
					<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
						<li class="tsd-signature tsd-kind-icon">handle<wbr>Write<wbr>Error<span class="tsd-signature-symbol">(</span>callback<span class="tsd-signature-symbol">: </span><a href="../modules.html#callback" class="tsd-signature-type" data-tsd-kind="Type alias">Callback</a><span class="tsd-signature-symbol">&lt;</span><a href="bulkwriteresult.html" class="tsd-signature-type" data-tsd-kind="Class">BulkWriteResult</a><span class="tsd-signature-symbol">&gt;</span>, writeResult<span class="tsd-signature-symbol">: </span><a href="bulkwriteresult.html" class="tsd-signature-type" data-tsd-kind="Class">BulkWriteResult</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span></li>
					</ul>
					<ul class="tsd-descriptions">
						<li class="tsd-description">
							<aside class="tsd-sources">
								<p>Inherited from <a href="bulkoperationbase.html">BulkOperationBase</a>.<a href="bulkoperationbase.html#handlewriteerror">handleWriteError</a></p>
								<ul>
									<li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/b67af3cd/src/bulk/common.ts#L1214">src/bulk/common.ts:1214</a></li>
								</ul>
							</aside>
							<div class="tsd-comment tsd-typography">
								<div class="lead">
									<p>Handles the write error before executing commands</p>
								</div>
								<dl class="tsd-comment-tags">
									<dt>internal</dt>
									<dd></dd>
								</dl>
							</div>
							<h4 class="tsd-parameters-title">Parameters</h4>
							<ul class="tsd-parameters">
								<li>
									<h5>callback: <a href="../modules.html#callback" class="tsd-signature-type" data-tsd-kind="Type alias">Callback</a><span class="tsd-signature-symbol">&lt;</span><a href="bulkwriteresult.html" class="tsd-signature-type" data-tsd-kind="Class">BulkWriteResult</a><span class="tsd-signature-symbol">&gt;</span></h5>
								</li>
								<li>
									<h5>writeResult: <a href="bulkwriteresult.html" class="tsd-signature-type" data-tsd-kind="Class">BulkWriteResult</a></h5>
								</li>
							</ul>
							<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span></h4>
						</li>
					</ul>
				</section>
				<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
					<a name="insert" class="tsd-anchor"></a>
					<h3>insert</h3>
					<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
						<li class="tsd-signature tsd-kind-icon">insert<span class="tsd-signature-symbol">(</span>document<span class="tsd-signature-symbol">: </span><a href="../interfaces/document.html" class="tsd-signature-type" data-tsd-kind="Interface">Document</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="bulkoperationbase.html" class="tsd-signature-type" data-tsd-kind="Class">BulkOperationBase</a></li>
					</ul>
					<ul class="tsd-descriptions">
						<li class="tsd-description">
							<aside class="tsd-sources">
								<p>Inherited from <a href="bulkoperationbase.html">BulkOperationBase</a>.<a href="bulkoperationbase.html#insert">insert</a></p>
								<ul>
									<li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/b67af3cd/src/bulk/common.ts#L1007">src/bulk/common.ts:1007</a></li>
								</ul>
							</aside>
							<div class="tsd-comment tsd-typography">
								<div class="lead">
									<p>Add a single insert document to the bulk operation</p>
								</div>
								<dl class="tsd-comment-tags">
									<dt>example</dt>
									<dd><pre><code class="language-js"><span style="color: #0000FF">const</span><span style="color: #000000"> </span><span style="color: #0070C1">bulkOp</span><span style="color: #000000"> = </span><span style="color: #001080">collection</span><span style="color: #000000">.</span><span style="color: #795E26">initializeOrderedBulkOp</span><span style="color: #000000">();</span>

<span style="color: #008000">// Adds three inserts to the bulkOp.</span>
<span style="color: #001080">bulkOp</span>
<span style="color: #000000">  .</span><span style="color: #795E26">insert</span><span style="color: #000000">({ </span><span style="color: #001080">a:</span><span style="color: #000000"> </span><span style="color: #098658">1</span><span style="color: #000000"> })</span>
<span style="color: #000000">  .</span><span style="color: #795E26">insert</span><span style="color: #000000">({ </span><span style="color: #001080">b:</span><span style="color: #000000"> </span><span style="color: #098658">2</span><span style="color: #000000"> })</span>
<span style="color: #000000">  .</span><span style="color: #795E26">insert</span><span style="color: #000000">({ </span><span style="color: #001080">c:</span><span style="color: #000000"> </span><span style="color: #098658">3</span><span style="color: #000000"> });</span>
<span style="color: #AF00DB">await</span><span style="color: #000000"> </span><span style="color: #001080">bulkOp</span><span style="color: #000000">.</span><span style="color: #795E26">execute</span><span style="color: #000000">();</span>
</code></pre>
									</dd>
								</dl>
							</div>
							<h4 class="tsd-parameters-title">Parameters</h4>
							<ul class="tsd-parameters">
								<li>
									<h5>document: <a href="../interfaces/document.html" class="tsd-signature-type" data-tsd-kind="Interface">Document</a></h5>
								</li>
							</ul>
							<h4 class="tsd-returns-title">Returns <a href="bulkoperationbase.html" class="tsd-signature-type" data-tsd-kind="Class">BulkOperationBase</a></h4>
						</li>
					</ul>
				</section>
				<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
					<a name="raw" class="tsd-anchor"></a>
					<h3>raw</h3>
					<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
						<li class="tsd-signature tsd-kind-icon">raw<span class="tsd-signature-symbol">(</span>op<span class="tsd-signature-symbol">: </span><a href="../modules.html#anybulkwriteoperation" class="tsd-signature-type" data-tsd-kind="Type alias">AnyBulkWriteOperation</a><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/document.html" class="tsd-signature-type" data-tsd-kind="Interface">Document</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="orderedbulkoperation.html" class="tsd-signature-type" data-tsd-kind="Class">OrderedBulkOperation</a></li>
					</ul>
					<ul class="tsd-descriptions">
						<li class="tsd-description">
							<aside class="tsd-sources">
								<p>Inherited from <a href="bulkoperationbase.html">BulkOperationBase</a>.<a href="bulkoperationbase.html#raw">raw</a></p>
								<ul>
									<li>Defined in <a href="https://github.com/mongodb/node-mongodb-native/blob/b67af3cd/src/bulk/common.ts#L1064">src/bulk/common.ts:1064</a></li>
								</ul>
							</aside>
							<div class="tsd-comment tsd-typography">
								<div class="lead">
									<p>Specifies a raw operation to perform in the bulk write.</p>
								</div>
							</div>
							<h4 class="tsd-parameters-title">Parameters</h4>
							<ul class="tsd-parameters">
								<li>
									<h5>op: <a href="../modules.html#anybulkwriteoperation" class="tsd-signature-type" data-tsd-kind="Type alias">AnyBulkWriteOperation</a><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/document.html" class="tsd-signature-type" data-tsd-kind="Interface">Document</a><span class="tsd-signature-symbol">&gt;</span></h5>
								</li>
							</ul>
							<h4 class="tsd-returns-title">Returns <a href="orderedbulkoperation.html" class="tsd-signature-type" data-tsd-kind="Class">OrderedBulkOperation</a></h4>
						</li>
					</ul>
				</section>
			</section>
		</div>
		<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
			<nav class="tsd-navigation primary">
				<ul>
					<li class=" ">
						<a href="../modules.html">Exports</a>
					</li>
				</ul>
			</nav>
			<nav class="tsd-navigation secondary menu-sticky">
				<ul class="before-current">
				</ul>
				<ul class="current">
					<li class="current tsd-kind-class">
						<a href="orderedbulkoperation.html" class="tsd-kind-icon">Ordered<wbr>Bulk<wbr>Operation</a>
						<ul>
							<li class=" tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite">
								<a href="orderedbulkoperation.html#constructor" class="tsd-kind-icon">constructor</a>
							</li>
							<li class=" tsd-kind-property tsd-parent-kind-class tsd-is-inherited">
								<a href="orderedbulkoperation.html#isordered" class="tsd-kind-icon">is<wbr>Ordered</a>
							</li>
							<li class=" tsd-kind-property tsd-parent-kind-class tsd-is-inherited">
								<a href="orderedbulkoperation.html#operationid" class="tsd-kind-icon">operation<wbr>Id</a>
							</li>
							<li class=" tsd-kind-property tsd-parent-kind-class tsd-is-inherited">
								<a href="orderedbulkoperation.html#s" class="tsd-kind-icon">s</a>
							</li>
							<li class=" tsd-kind-get-signature tsd-parent-kind-class tsd-is-inherited">
								<a href="orderedbulkoperation.html#batches" class="tsd-kind-icon">batches</a>
							</li>
							<li class=" tsd-kind-get-signature tsd-parent-kind-class tsd-is-inherited">
								<a href="orderedbulkoperation.html#bsonoptions" class="tsd-kind-icon">bson<wbr>Options</a>
							</li>
							<li class=" tsd-kind-get-signature tsd-parent-kind-class tsd-is-inherited">
								<a href="orderedbulkoperation.html#writeconcern" class="tsd-kind-icon">write<wbr>Concern</a>
							</li>
							<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-overwrite">
								<a href="orderedbulkoperation.html#addtooperationslist" class="tsd-kind-icon">add<wbr>ToOperations<wbr>List</a>
							</li>
							<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
								<a href="orderedbulkoperation.html#execute" class="tsd-kind-icon">execute</a>
							</li>
							<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
								<a href="orderedbulkoperation.html#find" class="tsd-kind-icon">find</a>
							</li>
							<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
								<a href="orderedbulkoperation.html#handlewriteerror" class="tsd-kind-icon">handle<wbr>Write<wbr>Error</a>
							</li>
							<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
								<a href="orderedbulkoperation.html#insert" class="tsd-kind-icon">insert</a>
							</li>
							<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
								<a href="orderedbulkoperation.html#raw" class="tsd-kind-icon">raw</a>
							</li>
						</ul>
					</li>
				</ul>
				<ul class="after-current">
				</ul>
			</nav>
		</div>
	</div>
</div>
<footer class="with-border-bottom">
	<div class="container">
		<h2>Legend</h2>
		<div class="tsd-legend-group">
			<ul class="tsd-legend">
				<li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
				<li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li>
				<li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
				<li class="tsd-kind-accessor tsd-parent-kind-class"><span class="tsd-kind-icon">Accessor</span></li>
			</ul>
			<ul class="tsd-legend">
				<li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited constructor</span></li>
				<li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li>
				<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li>
				<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited accessor</span></li>
			</ul>
			<ul class="tsd-legend">
				<li class="tsd-kind-constructor tsd-parent-kind-interface"><span class="tsd-kind-icon">Constructor</span></li>
				<li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li>
				<li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li>
			</ul>
			<ul class="tsd-legend">
				<li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private property</span></li>
				<li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li>
			</ul>
			<ul class="tsd-legend">
				<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static property</span></li>
				<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li>
			</ul>
		</div>
	</div>
</footer>
<div class="container tsd-generator">
	<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="../assets/js/main.js"></script>
</body>
</html>